<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
	<link rel="stylesheet" type="text/css" href="<%=basePath%>/login/css/style.css" />
	<link rel="stylesheet" type="text/css" href="<%=basePath%>/login/css/theme1.css" />
	<style type="text/css">
td {
	border: none;
}

fieldset {
	display: block;
	padding: 5px 10px 5px 10px;
	line-height: 20px;
	margin-bottom: 10px;
	border: 1px solid #d9e6f0;
	margin-left: 10px;
}

fieldset legend {
	border: 1px solid #d9e6f0;
	background: #fff url(img/form_blue.gif) repeat-x center left;
	color: #375b91;
	font-size: 12px;
	font-weight: bold;
	margin-bottom: 5px;
	padding: 3px;
	width: 150px;
}
textarea{
	border:1px solid #d9e6f0;
	background:#fff url(login/img/form_blue.gif) repeat-x bottom left;
	padding:5px;
	overflow:auto;
}
select{
	margin-left:0px;
	width:181px;
}
.checkboxLabel{
	width:60px;
}
.p{
	margin-top: 10px;
	margin-bottom: 10px;
	border: 1px solid #d9e6f0;
}
</style>
<script type="text/javascript" src="<%=basePath%>/login/scripts/common.js"></script>
<script type="text/javascript" src="<%=basePath%>/login/scripts/jquery-1.3.2.min.js"></script>
<SCRIPT type="text/javascript">
	function checkAll(){
		if ($("#cb_all").attr("checked") == true) {
			$("input[name='man']").attr("checked", "true");
		} else {
			$("input[name='man']").removeAttr("checked");
		}
	}
	function selectType(typeId){
		var flag=$("#cbox_type_"+typeId).attr("checked");
		$("input[class='class_type_"+typeId+"']").attr("checked",flag);
	}
	function selectTown(townId){
		var flag=$("#cbox_town_"+townId).attr("checked");
		$("input[title='class_town_"+townId+"']").attr("checked",flag);
	}
</SCRIPT>
</head>
<body>
<div id="wrapper" style="margin-top: 10px;">
	<div id="content">
		<div id="box">
			<div>
				<h3>
					当前位置&nbsp;:&nbsp;气象信息员管理&nbsp;>>&nbsp;短信发送
				</h3>
			</div>
			<div id="search_bar">
				<form action="adminAction!searchMan.action" method="post">
				<table width="100%" border="0" cellspacing="3" cellpadding="0">
					<tr>
						<td>
							姓名:
							<s:textfield name="linkmanBean.lmName" theme="simple"></s:textfield>
							<input type="submit" value="搜索" />
						</td>
					</tr>
				</table>
				</form>
			</div>
			<form method="post" action="adminAction!msgSend.action">
			<fieldset id="personal" style="width: 900px;">
			 	<legend>
					接收人：
					<input type="checkbox" id="cb_all" class="cbox_all" onclick="javascript: checkAll();"/>全选
				</legend>
				<p class="p">
					类别:<br>
					<c:forEach items="${manTypeList}" var="type">
						<span style="width:100px;"><input type="checkbox" class="cbox_all" id="cbox_type_${type.id}" onclick="javascript:selectType('${type.id}');"/>${type.name}</span>
					</c:forEach>
				</p>
				<p class="p">
					所属镇区:<br>
					<c:forEach items="${townList}" var="town">
						<span style="width:100px;"><input type="checkbox" class="cbox_all" id="cbox_town_${town.TNum}" onclick="javascript:selectTown('${town.TNum}');"/>${town.TName}</span>
					</c:forEach>
				</p>
				<div>
				 <div>
<%--				 <s:checkboxlist name="man" list="manList" listKey="lmId" listValue="lmName" cssClass="linkmanType.id" ></s:checkboxlist>--%>
					<c:choose>
						<c:when test="${empty linkmanList}">
							<c:forEach items="${manList}" var="lm">
								<span style="width:100px;">
								<input type="checkbox" name="man" class="class_type_${lm.linkmanType.id}" value="${lm.lmId}" id="lm_${lm.lmId}" title="class_town_${lm.townId.TNum}"/>${lm.lmName}</span>
							</c:forEach>
						</c:when>
						<c:otherwise>
							<c:forEach items="${linkmanList}" var="lm">
								<span style="width:100px;">
								<input type="checkbox" name="man" class="class_type_${lm.linkmanType.id}" value="${lm.lmId}" id="lm_${lm.lmId}" title="class_town_${lm.townId.TNum}"/>${lm.lmName}</span>
							</c:forEach>
						</c:otherwise>
					</c:choose>
				 </div>
				</div>
			</fieldset>
			<fieldset id="personal2">
			  <legend>
					发送内容
				</legend>
				<div>
				 <textarea rows="8" cols="80" name="message"></textarea>
				</div>
			</fieldset>
			<div align="center">
            	<input type="submit" value="发送短信"/>&nbsp;&nbsp;
				<input type="button" value="返  回" onclick="javascript:forBack();"/>
			</div>
			</form>
			<br/>
		</div>
	</div>
</div>
</body>
</html>